package com.iweb.filter;

import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * 作者: jack
 * 时间: 2020-07-07 21:11
 * 描述: TokenFilter
 */
@Component
public class TokenFilter implements GlobalFilter, Ordered {
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        System.out.println("TokenFilter is filter");
        // TO DO
        return chain.filter(exchange);
    }

    //设置过滤器执行顺序，值越小，优先级越高
    @Override
    public int getOrder() {
        return 0;
    }
}
